package cn.com.clearbus.base;

import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.beans.BeanUtils;

import java.io.Serializable;

@Data
@Accessors(chain = true)
public abstract class BaseEntity implements Serializable {



    /**
     * 实体类装填DTO
     * @Date 2019-03-03
     * @Author wxs
     * @param entity   源实体实例
     */
    public final void entity2dto(Object entity){
        BeanUtils.copyProperties(entity,this);
    }
    /**
     * DTO装填实体类
     * @Date 2019-03-06
     * @Author wxs
     * @param entity   源实体实例
     */
    public final void dto2entity(Object entity){
        BeanUtils.copyProperties(this,entity);
    }

}
